import request from "@/utils/request";
import { ParseData } from "@/utils/utils";

//获取产品列表分页
export const GetProductList = (data: any) => {
  return request({
    method: "GET",
    url: `/chanpin?${ParseData(data)}`,
  });
};
//获取选择产品列表分页
export const GetChooseProductList = (data: any) => {
  return request({
    method: "GET",
    url: `/chanpin/xuanze?${ParseData(data)}`,
  });
};
//新建产品
export const AddProduct = (data: any) => {
  return request({
    method: "POST",
    url: `/chanpin`,
    data,
  });
};
//编辑产品
export const EditProduct = (data: any) => {
  return request({
    method: "PUT",
    url: `/chanpin`,
    data,
  });
};
//审核产品
export const ReviewProduct = (data: any) => {
  return request({
    method: "PUT",
    url: `/chanpin/shenhe`,
    data,
  });
};
//备注产品
export const NoteProduct = (data: any) => {
  return request({
    method: "PUT",
    url: `/chanpin/beizhu`,
    data,
  });
};
//删除产品
export const DeleteProduct = (data: any) => {
  return request({
    method: "DELETE",
    url: `/chanpin/${data.id}`,
  });
};
// 查看产品
export const GetProduct = (data: any) => {
  return request({
    method: "GET",
    url: `/chanpin/${data.id}`,
  });
};
// 查看产品详情
export const GetProductDetail = (data: any) => {
  return request({
    method: "GET",
    url: `/chanpin/xiangqing/${data.id}`,
  });
};
//产品详情-获取产品专家信息
export const GetProductExpertDetail = (data: any) => {
  return request({
    method: "GET",
    url: `/chanpin/xiangqing/zhuanjia?${ParseData(data)}`,
  });
};
//产品详情-更改产品专家信息
export const ChangeProductExpert = (data: any) => {
  return request({
    method: "PUT",
    url: `/chanpin/xiangqing/zhuanjia`,
    data,
  });
};
//产品详情-获取项目案例列表分页
export const GetProductDemoList = (data: any) => {
  return request({
    method: "GET",
    url: `/chanpin/xiangqing/xiangmu?${ParseData(data)}`,
  });
};
//产品详情-获取专家评论列表分页
export const GetProductCommentList = (data: any) => {
  return request({
    method: "GET",
    url: `/chanpin/xiangqing/pinglun?${ParseData(data)}`,
  });
};
//产品详情-专家评论置顶
export const AddTopProductComment = (data: any) => {
  return request({
    method: "PUT",
    url: `/chanpin/xiangqing/pinglun/zhiding/${data.id}`,
  });
};
//产品详情-专家评论加V
export const AddVProductComment = (data: any) => {
  return request({
    method: "PUT",
    url: `/chanpin/xiangqing/pinglun/renzhengjiav/${data.id}`,
  });
};
//新建产品
export const ProductUpload = (data: any) => {
  return request({
    method: "POST",
    url: `/chanpin/daoru`,
    data,
  });
};
